<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div>
    <el-row>
      <el-col :span='22' :xs='24'>
        <el-form ref="form" :model="s_quality" :rules="rules" label-width="100px" id="mvcfm">
          <el-button @click="popQualificationsAdd('')" type='success' size="mini"><i class='fa fa-plus'></i>增加资质</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 企业资质 </span>
          </div>
          <el-table :data="s_quality">
            <el-table-column label="操作" align="center" width='100' type=''>
              <template slot-scope="scope">
                <el-dropdown trigger="click">
                  <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>
                      <el-link @click="d_quality('&CMID1='+scope.row.quality_id+'')">删除</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="popQualificationsUp('&CMID1='+scope.row.quality_id+'')">修改</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="gotoPage('/xcapi/ProcessFile/DownloadFile.do?&fileverid='+scope.row.version_id+''+vueparams+'')">下载文件</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="popSubsidiaryInfo('&fileverid='+scope.row.version_id+'')">查看文件</el-link>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </template>
            </el-table-column>
            <el-table-column label="类型" prop="quality_type">
            </el-table-column>
            <el-table-column label="资质文件" prop="version_id">
              <template slot-scope="scope">
              </template>
            </el-table-column>
            <el-table-column label="证书编号" prop="quality_num">
            </el-table-column>
            <el-table-column label="资质验证" prop="verify_type">
            </el-table-column>
            <el-table-column label="资质查询网站" prop="verify_url">
              <template slot-scope="scope">
                <el-link href="gotoPage('http://'+emt.map['verify_url']+'')" type='primary'>{{scope.row.verify_url}}</el-link>
              </template>
            </el-table-column>
          </el-table>
          <el-button @click="popBankAccountAdd('')" type='success' size="mini"><i class='fa fa-plus'></i>增加银行账户</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 银行账户信息 </span>
          </div>
          <el-table :data="s_bank_account">
            <el-table-column label="操作" align="center" width='100' type=''>
              <template slot-scope="scope">
                <el-dropdown trigger="click">
                  <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>
                      <el-link @click="popBankAccountUp('&CMID1='+scope.row.account_id+'')">修改</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="d_bank_account('&CMID1='+scope.row.account_id+'')">删除</el-link>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </template>
            </el-table-column>
            <el-table-column label="类型" prop="account_type">
            </el-table-column>
            <el-table-column label="开户银行" prop="bank_name">
            </el-table-column>
            <el-table-column label="开户名称" prop="account_name">
            </el-table-column>
            <el-table-column label="银行账户" prop="bank_account">
            </el-table-column>
          </el-table>
        </el-form>
      </el-col>
      <el-col :span='2' :xs='24'>
        <el-menu default-active='active' class='menu-unit'>
          <el-menu-item v-for='item in Container'>
            <el-link @click="gotoMenu(item.url)" :type="'附属信息'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
    <el-dialog :visible.sync="QualificationsUpVisible" append-to-body>
      <QualificationsUp v-if="QualificationsUpVisible" ref="QualificationsUp" :popparams="popparams"> </QualificationsUp>
    </el-dialog>
    <el-dialog :visible.sync="SubsidiaryInfoVisible" append-to-body>
      <SubsidiaryInfo v-if="SubsidiaryInfoVisible" ref="SubsidiaryInfo" :popparams="popparams"> </SubsidiaryInfo>
    </el-dialog>
    <el-dialog :visible.sync="QualificationsAddVisible" append-to-body>
      <QualificationsAdd v-if="QualificationsAddVisible" ref="QualificationsAdd" :popparams="popparams"> </QualificationsAdd>
    </el-dialog>
    <el-dialog :visible.sync="BankAccountUpVisible" append-to-body>
      <BankAccountUp v-if="BankAccountUpVisible" ref="BankAccountUp" :popparams="popparams"> </BankAccountUp>
    </el-dialog>
    <el-dialog :visible.sync="BankAccountAddVisible" append-to-body>
      <BankAccountAdd v-if="BankAccountAddVisible" ref="BankAccountAdd" :popparams="popparams"> </BankAccountAdd>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import QualificationsUp from "@/views/crm/sale/QualificationsUp";
  import SubsidiaryInfo from "@/views/crm/sale/SubsidiaryInfo";
  import QualificationsAdd from "@/views/crm/sale/QualificationsAdd";
  import BankAccountUp from "@/views/crm/sale/BankAccountUp";
  import BankAccountAdd from "@/views/crm/sale/BankAccountAdd";
  export default {
    name: 'SubsidiaryInfo',
    components: {
      QualificationsUp,
      SubsidiaryInfo,
      QualificationsAdd,
      BankAccountUp,
      BankAccountAdd,
    },
    props: ['popparams'],
    data() {
      return {
        QualificationsUpVisible: false,
        QualificationsUpValue: null,
        QualificationsUpDesc: null,
        SubsidiaryInfoVisible: false,
        SubsidiaryInfoValue: null,
        SubsidiaryInfoDesc: null,
        QualificationsAddVisible: false,
        QualificationsAddValue: null,
        QualificationsAddDesc: null,
        BankAccountUpVisible: false,
        BankAccountUpValue: null,
        BankAccountUpDesc: null,
        BankAccountAddVisible: false,
        BankAccountAddValue: null,
        BankAccountAddDesc: null,
        vueparams: this.getVUEParams(""),
        s_quality: [],
        s_bank_account: [],
        loading: false,
        Container: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.loadContainerMenu({
        pid: "80299289AF2443B18EA545A4C0C37170",
        name: "客户管理右菜单",
        selected: "附属信息"
      }, 'Container', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/crm/sale/SubsidiaryInfo/subsidiaryInfo?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      d_quality(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/crm/sale/SubsidiaryInfo/d_quality?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      d_bank_account(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/crm/sale/SubsidiaryInfo/d_bank_account?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      popQualificationsUp(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.QualificationsUpVisible = !this.QualificationsUpVisible;
      },
      popSubsidiaryInfo(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.SubsidiaryInfoVisible = !this.SubsidiaryInfoVisible;
      },
      popQualificationsAdd(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.QualificationsAddVisible = !this.QualificationsAddVisible;
      },
      popBankAccountUp(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.BankAccountUpVisible = !this.BankAccountUpVisible;
      },
      popBankAccountAdd(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.BankAccountAddVisible = !this.BankAccountAddVisible;
      },
    },
  }
</script>
